<?php

error_reporting(E_ALL ^ E_NOTICE);

require(__DIR__ . '/../../loadEnv.php');

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'prod');

require(__DIR__ . '/../../framework/yii/autoload.php');
require(__DIR__ . '/../../framework/yii/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');

require(__DIR__ . '/../../vendor/autoload.php');

require_once(dirname(__FILE__) . '/../../common/components/Environment.php');
$environment = new Environment(); //creating an object
$environment->setHost($_SERVER['HTTP_HOST']); // setting current host

$environment->setConfigDir(dirname(__FILE__) . '/../../common/config/'); //setting where to search config files
$environment->setSearchDir(dirname(__FILE__) . '/../../common/config/');
$common_config = $environment->getConfig(); // receiving appropriate file
//print_r($common_config);exit;
$environment->setSearchDir(dirname(__FILE__) . '/config/');
$local_config = $environment->getConfig();
$api_config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../common/config/main.php'),
    require(__DIR__ . '/config/main.php'),
    $common_config,
  //  $local_config
);
//print_r($local_config);exit;
$application = new yii\web\Application($api_config);
$application->run();
